#pragma once

#include <torch/torch.h>
#include "GSSplat.h"

using namespace torch::autograd;

int degFromSh(int vNumBases);
torch::Tensor rgb2sh(const torch::Tensor& vRgb);
torch::Tensor sh2rgb(const torch::Tensor& vSH);

class CSphericalHarmonics : public Function<CSphericalHarmonics> {
public:
    static torch::Tensor forward(AutogradContext* vCtx,
        int vDegreesToUse,
        torch::Tensor vViewDirs,
        torch::Tensor vCoeffs);
    static tensor_list backward(AutogradContext* vCtx, tensor_list vGradOutputs);
};
